package object;

public class Students {
    private String name;
    private int age;
    //调用时不传递参数会默认使用无参构造器，由虚拟机自动调用，对成员变量进行初始化
    public  Students(){
        int age = 10;
        //this用来区分成员变量和局部变量，this 代表方法调用者的地址值
        System.out.println(age+ "age-----");
        System.out.println(this.age+"this.age-----");
        System.out.println("无参构造器");
    }
    //有参构造器
    public Students(String name,int age){
        this.name = name;
        this.age = age;
        System.out.println("有参构造器");
    }
}
